package hopital.ui;


import javax.swing.DefaultListModel;
import javax.swing.JList;

public class List<T> extends JList<T> {

    
    private static final long serialVersionUID = 1L;

    private final DefaultListModel<T> _model;

    public List() {
        _model = new DefaultListModel<>();
        setModel(_model);
    }


    public void addItem(T arg0) {
        _model.addElement(arg0);
    }

    public void removeItem(T arg0) {
        _model.removeElement(arg0);
    }

    public void addItems(T[] args) {
        for (T o : args) {
            addItem(o);
        }

    }

    public void removeItems(T[] args) {
        for (T o : args) {
            this.removeItem(o);
        }
    }

    public void removeItems() {
        _model.setSize(0);
    }

    public void removeItem(int arg0) {
        _model.removeElementAt(arg0);
    }

}
